package yawning.mew.gui.characters.glyphs;

import java.awt.BorderLayout;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;

import yawning.mew.gui.tools.CharacterDataSource;

@SuppressWarnings("serial")
public class GlyphsContainer extends JPanel {
	//private CharacterDataSource toon;
	private JTable glyphsTable;
	
	/**
	 * Create the panel.
	 */
	public GlyphsContainer(CharacterDataSource toon) {
		//this.toon = toon;
		setLayout(new BorderLayout(0, 0));
		
		JScrollPane scrPane = new JScrollPane();
		add(scrPane);
		
		glyphsTable = new JTable(new GlyphTableModel(toon.getGlyphArray()));
		scrPane.setViewportView(glyphsTable);
		glyphsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		glyphsTable.setFillsViewportHeight(true);
		glyphsTable.setColumnSelectionAllowed(true);
		glyphsTable.getTableHeader().setVisible(true);
		glyphsTable.getColumnModel().setColumnSelectionAllowed(false);
		glyphsTable.setRowSelectionAllowed(true);
		glyphsTable.getColumnModel().getColumn(0).setResizable(false);
		glyphsTable.getColumnModel().getColumn(0).setPreferredWidth(50);
		glyphsTable.getColumnModel().getColumn(0).setMaxWidth(75);
		glyphsTable.getColumnModel().getColumn(1).setResizable(false);
		glyphsTable.getColumnModel().getColumn(1).setPreferredWidth(50);
		glyphsTable.getColumnModel().getColumn(2).setResizable(false);
		glyphsTable.getColumnModel().getColumn(2).setPreferredWidth(128);
		glyphsTable.getColumnModel().getColumn(3).setResizable(false);
		glyphsTable.getColumnModel().getColumn(3).setPreferredWidth(512);
		initDataBindings();

	}
	protected void initDataBindings() {
	}
}
